<?php
if(!isset($type)){
	$type = 'single';
}
?>
<div class="post">
	<h3><?php
	$title = h($post['Post']['title']);
	if($type == 'multiple'){
		e($html->link($title, array(
			'controller' => 'posts',
			'action' => 'view',
			'id' => $post['Post']['id'],
		)));
	}
	else{
		e($title);
	}
	?></h3>
	<h6 class="meta">
		Published <?php e($time->timeAgoInWords($post['Post']['created'])); ?>
		<?php
		if(!empty($post['Tag'])){
			e('in ');
			$t = array();
			foreach($post['Tag'] as $tag){
				$t[] = $html->link($tag['title'], array(
					'controller' => 'tags',
					'action' => 'view',
					'id' => $tag['id'],
				));
			}
			e($text->toList($t));
		}
		?>.
		<?php
		$numComments = count($post['Comment']);
		e($html->link(
			$numComments . ' ' . ($numComments == 1 ? 'Comment' : 'Comments'),
			'/posts/view/' . $post['Post']['id'] . '#comments',
			array(
				'class' => 'commentslink',
			)
		));
		?>
	</h6>
	<div class="content">
		<?php
		if($type == 'multiple'){
			e($text->truncate($post['Post']['content']));
		}
		else{
			e($markdown->parse($post['Post']['content']));
		}
		?>
	</div>
</div>